Skip to content

fix(vsock): restore listener after accept#2434

Open
archevel wants to merge 4 commits into
hermit-os:mainfrom
archevel:fix-issue-with-vsock-accept
Open

fix(vsock): restore listener after accept#2434
archevel wants to merge 4 commits into
hermit-os:mainfrom
archevel:fix-issue-with-vsock-accept

Conversation

@archevel
Copy link
Copy Markdown

After accepting a connection, move the accepted socket to an ephemeral port and reset the listener entry to Listen state. Track the listen port separately in Socket so subsequent accept calls always find the listener entry regardless of how many connections have been accepted.

Fixes #2433

After accepting a connection, move the accepted socket to an ephemeral
port and reset the listener entry to Listen state. Track the listen port
separately in Socket so subsequent accept calls always find the listener
entry regardless of how many connections have been accepted.

Fixes hermit-os#2433
@archevel
Copy link
Copy Markdown
Author

As a reference I made this pull request as well with a regression test:
hermit-os/hermit-rs#996

Copy link
Copy Markdown

@github-actions github-actions Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Benchmark Results

Details
Benchmark Current: 1391ad4 Previous: ede71c0 Performance Ratio
startup_benchmark Build Time 106.03 s 99.20 s 1.07
startup_benchmark File Size 0.76 MB 0.76 MB 1.00
Startup Time - 1 core 0.94 s (±0.04 s) 0.94 s (±0.04 s) 1.01
Startup Time - 2 cores 0.95 s (±0.05 s) 0.96 s (±0.05 s) 0.99
Startup Time - 4 cores 0.96 s (±0.04 s) 0.96 s (±0.04 s) 1.00
multithreaded_benchmark Build Time 111.97 s 107.20 s 1.04
multithreaded_benchmark File Size 0.86 MB 0.86 MB 1.00
Multithreaded Pi Efficiency - 2 Threads 85.13 % (±19.04 %) 91.00 % (±14.55 %) 0.94
Multithreaded Pi Efficiency - 4 Threads 41.93 % (±8.82 %) 45.27 % (±7.73 %) 0.93
Multithreaded Pi Efficiency - 8 Threads 23.00 % (±5.01 %) 24.88 % (±3.26 %) 0.92
micro_benchmarks Build Time 88.84 s 92.81 s 0.96
micro_benchmarks File Size 0.86 MB 0.86 MB 1.00
Scheduling time - 1 thread 69.04 ticks (±4.75 ticks) 68.53 ticks (±3.92 ticks) 1.01
Scheduling time - 2 threads 39.29 ticks (±4.67 ticks) 39.67 ticks (±4.24 ticks) 0.99
Micro - Time for syscall (getpid) 2.91 ticks (±0.27 ticks) 2.95 ticks (±0.28 ticks) 0.99
Memcpy speed - (built_in) block size 4096 75842.73 MByte/s (±52602.22 MByte/s) 79590.12 MByte/s (±55157.77 MByte/s) 0.95
Memcpy speed - (built_in) block size 1048576 29986.48 MByte/s (±24458.18 MByte/s) 29900.58 MByte/s (±24427.92 MByte/s) 1.00
Memcpy speed - (built_in) block size 16777216 27308.99 MByte/s (±22620.07 MByte/s) 29198.54 MByte/s (±24141.87 MByte/s) 0.94
Memset speed - (built_in) block size 4096 76044.15 MByte/s (±52757.44 MByte/s) 79808.67 MByte/s (±55316.96 MByte/s) 0.95
Memset speed - (built_in) block size 1048576 30707.63 MByte/s (±24874.96 MByte/s) 30660.50 MByte/s (±24865.67 MByte/s) 1.00
Memset speed - (built_in) block size 16777216 28080.64 MByte/s (±23094.09 MByte/s) 29947.79 MByte/s (±24563.56 MByte/s) 0.94
Memcpy speed - (rust) block size 4096 72737.83 MByte/s (±50909.39 MByte/s) 71838.02 MByte/s (±50156.20 MByte/s) 1.01
Memcpy speed - (rust) block size 1048576 30132.90 MByte/s (±24534.94 MByte/s) 29850.23 MByte/s (±24412.52 MByte/s) 1.01
Memcpy speed - (rust) block size 16777216 27539.62 MByte/s (±22686.22 MByte/s) 29179.09 MByte/s (±24119.28 MByte/s) 0.94
Memset speed - (rust) block size 4096 72916.97 MByte/s (±51028.21 MByte/s) 72078.48 MByte/s (±50299.01 MByte/s) 1.01
Memset speed - (rust) block size 1048576 30882.95 MByte/s (±24963.32 MByte/s) 30581.94 MByte/s (±24812.57 MByte/s) 1.01
Memset speed - (rust) block size 16777216 28297.31 MByte/s (±23146.26 MByte/s) 29935.12 MByte/s (±24543.49 MByte/s) 0.95
alloc_benchmarks Build Time 86.24 s 85.84 s 1.00
alloc_benchmarks File Size 0.84 MB 0.84 MB 1.00
Allocations - Allocation success 100.00 % 100.00 % 1
Allocations - Deallocation success 100.00 % 100.00 % 1
Allocations - Pre-fail Allocations 100.00 % 100.00 % 1
Allocations - Average Allocation time 4280.39 Ticks (±509.58 Ticks) 4581.75 Ticks (±1166.54 Ticks) 0.93
Allocations - Average Allocation time (no fail) 4280.39 Ticks (±509.58 Ticks) 4581.75 Ticks (±1166.54 Ticks) 0.93
Allocations - Average Deallocation time 717.80 Ticks (±160.90 Ticks) 878.84 Ticks (±180.10 Ticks) 0.82
mutex_benchmark Build Time 85.96 s 101.79 s 0.84
mutex_benchmark File Size 0.87 MB 0.87 MB 1.00
Mutex Stress Test Average Time per Iteration - 1 Threads 13.02 ns (±0.84 ns) 13.22 ns (±0.73 ns) 0.98
Mutex Stress Test Average Time per Iteration - 2 Threads 16.92 ns (±8.77 ns) 19.06 ns (±1.33 ns) 0.89

This comment was automatically generated by workflow using github-action-benchmark.

@mkroening mkroening self-assigned this May 16, 2026
@mkroening mkroening self-requested a review May 16, 2026 17:06
@archevel archevel force-pushed the fix-issue-with-vsock-accept branch from 457df22 to 1391ad4 Compare May 28, 2026 09:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

vsock listener cannot accept a second connection

2 participants